// FaceDetectorModule.h

#pragma once
#include <string>
#include <vector>
#include <map>
#include "cv.h"
#include "ml.h"

/*******************************************************************/
struct SFaceObject
{
	CvPoint m_pt1;
	CvPoint m_pt2;	
	CvRect m_face;
	std::string m_type;
};
/*******************************************************************/
typedef std::vector<SFaceObject> TFaceList;
typedef std::vector<SFaceObject>::iterator TFaceListIter;
typedef std::vector<SFaceObject>::reverse_iterator TFaceRIter;
/*******************************************************************/
class CFaceDetectorModule 
{
public:
	CFaceDetectorModule(void);
	virtual ~CFaceDetectorModule(void);
	bool InitializeHaarDetectors( std::string path, std::vector<std::string> cascades, std::vector<std::string> names );
	TFaceList DetectFaces( IplImage * img );
	TFaceList DetectAndDrawFaces( IplImage * img ); 
	void DrawFaces( IplImage* img, TFaceList faces);
	SFaceObject GetBiggestFace( IplImage * img ); 
	void SetScale( int scale );
	int  GetScale( void );
	void DrawFace( IplImage* img, SFaceObject face ); 

protected:
	std::map<std::string, CvHaarClassifierCascade*> m_detectors;
	std::map<std::string, CvScalar> m_colorMap; 
	CvMemStorage* m_storage;
	CvSize m_size;
	int m_scale;
	std::vector<CvScalar> m_colors;

};
/*******************************************************************/
